{include file='common/head'}
<body>
<div class="x-body">
    <form class="layui-form" method="post" action="{:url('admin/indent/insert')} " enctype="multipart/form-data">
        <input type="hidden" name="uname" value="{$Think.session.gname}">
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red"></span>支付类型
            </label>
            <div class="layui-input-inline">
                <select name="zid">
                    <option value="">选择支付方式</option>
                    {volist name='ztype' id='ztype'}
                    <option value="{$ztype.zid}">{$ztype.z_type}</option>
                    {/volist}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red"></span>支付金额
            </label>
            <div class="layui-input-inline">
                <input type="text" name="t_money" required="" lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                确认发布
            </button>
        </div>
    </form>
</div>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //监听提交
        form.on('submit(add)', function(data){
            console.log(data);
            var url="";
            $.ajax({
                type: "post",
                async:false,
                url: "{:url('admin/indent/insert')}",
                data: data.field,
                success:function (res) {
                    if(res==1){
                        layer.msg('发布成功');
                        setTimeout(function () {
                            // 获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            window.parent.location.reload();//刷新父级窗口
                        }, 2000);
                    }
                    else
                    {
                        layer.msg(res.msg);
                    }
                }
            })
            //发异步，把数据提交给php
            //layer.alert("增加成功", {icon: 6},function () {
            // 获得frame索引
            //var index = parent.layer.getFrameIndex(window.name);
            //关闭当前frame
            // parent.layer.close(index);
            //  });
            return false;
        });


    });
</script>

</body>

</html>